<template>
  <div class="user_content">
    <div>
      <div class="user_img">
        <img :src="userInfo.user_img" alt="" v-if="userInfo.user_img" />
        <img src="../../assets/default_img.jpg" alt="" v-else />
      </div>
      <div class="user_edit">
        <div>
          <p>
            <span>0</span>
            <span>粉丝</span>
          </p>
          <p>
            <span>54</span>
            <span>关注</span>
          </p>
          <p>
            <span>0</span>
            <span>获赞</span>
          </p>
        </div>
        <div @click="$router.push('/edit')">
          <div class="edit_btn">编辑资料</div>
        </div>
      </div>
    </div>
    <div>
      <h2>{{ userInfo.name }}</h2>
      <p v-if="userInfo.user_desc">{{ userInfo.user_desc }}</p>
      <p v-else>这个人很懒，什么都没写</p>
    </div>
  </div>
</template>

<script>
export default {
  props: ['userInfo']
}
</script>

<style lang="less" scoped>
.user_content {
  background-color: #fff;
  padding: 0 1.389vw;
  margin: 0;
  > div:nth-child(1) {
    display: flex;
    .user_img {
      margin: -2.778vw 5.556vw 0 0;
      img {
        height: 24.389vw;
        width: 24.389vw;
        border-radius: 50%;
      }
    }
    .user_edit {
      flex: 1;
      div:nth-child(1) {
        display: flex;
        margin: 2.222vw;
        p:nth-child(1),
        p:nth-child(2) {
          border-right: 0.278vw solid #ccc;
        }
        p {
          flex: 1;
          display: flex;
          justify-content: center;
          align-items: center;
          flex-direction: column;
          font-size: 4vw;
          span:nth-child(even) {
            color: #aaa;
          }
        }
      }
      div:nth-child(2) {
        padding: 0 2.556vw;
        .edit_btn {
          border: 0.278vw solid #fb7a9f;
          display: flex;
          justify-content: center;
          align-items: center;
          padding: 1.389vw;
          border-radius: 1.389vw;
          color: #fb7a9f;
          font-size: 4.444vw;
        }
      }
    }
  }

  > div:nth-child(2) {
    h2 {
      font-size: 6.111vw;
      margin: 0;
      font-weight: 400;
    }
    p {
      padding: 2vw 0;
      font-size: 4.444vw;
      color: #aaa;
    }
  }
}
</style>
